{extend name="default/template/base_index" /}

{block name="area_header"}
	<link rel="stylesheet" type="text/css" media="all" href="__CSS__/wxshop.css">
	<link type="text/css" rel="stylesheet" src="__CDN__/jquery-uploadify/3.2.1/uploadify.css" />
	<script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>
	<script type="text/javascript" src="__CDN__/jquery-qrcode/v1.0/jquery.qrcode.min.js"></script>
	<style type="text/css">
		.main-img{
			width: 300px;
			height: 85px;
		}
		.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{
			vertical-align: middle;
		}
	</style>

{/block}

{block name="area_body"}
	{include file="default/Widget/topbar" /}
	<div class="admin-main container-fluid">
		{include file="default/Widget/left" /}
		<div class="admin-main-content">
			{include file="default/Widget/breadcrumb" /}
			<h4>当前店铺: <strong>{$store.name}</strong></h4>
			<!-- 过滤\查询按钮 -->
			<div class="filter-controls">
				<!-- 日期查询 -->
				<form action="{:url('ProductPackage/index')}" method="post" class="form-inline">
					<input type="hidden" name="store_id" value="{$store_id}" />
					<input type="hidden" name="status" class="selectitem" value="{$onshelf}">
					<div class="form-group">
						<label>套餐类别</label>
						<select id="type_selector" class="form-control input-short input-sm select_type" name="type">
							<option value="-1">全部</option>
							<option value="0" <if condition="I('get.type',-1) eq 0">selected="selected"</if>>默认套餐</option>
							<option value="1" <if condition="I('get.type',-1) eq 1">selected="selected"</if>>搭配购套餐</option>
						</select>
					</div>
					<div class="form-group">
						<label>套餐名称</label>
						<input type="text" name="s" class="form-control input-sm" value="{$s}" placeholder="请输入套餐名称" />
					</div>
					<button type="submit" class="btn btn-default btn-sm" id="searchFormSubmit"><i class="fa fa-search"></i>{:L('BTN_SEARCH')}</button>
				</form>
			</div>
			<!-- 操作按钮 -->
			<div class="btn-controls">
				<a class="btn btn-primary btn-sm" href="{:url('ProductPackage/edit')}"><i class="fa fa-plus"></i>添加套餐</a>
				<a class="btn btn-danger btn-sm ajax-post confirm" href="{:url('ProductPackage/delete')}" target-form="selectitem"><i class="fa fa-trash-o"></i>删除选中套餐</a>
			</div>
			<table class="table table-striped table table-hover  table-condensed">
				<thead>
					<tr>
						<th>
							<input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');" />ID
						</th>
						<th>
							套餐主图
						</th>
						<th>
							套餐名称
						</th>
						<th>
							创建时间
						</th>
						<th>
							结束时间
						</th>
						<th>
							套餐总价
						</th>
						<th width="20%">
							套餐描述
						</th>
						<th>
							套餐类别
						</th>
						<th>
							操作
						</th>
					</tr>
				</thead>
				<tbody>
					{empty name="list"}
						<tr>
							<td colspan="8" class="text-center">{:L('NO_DATA')}</td>
						</tr>
						{else/}
						{volist name="list" id="vo"}
							<tr>
								<td>
									<input type="checkbox" value="{$vo.id}" name="ids[]" class="selectitem" />{$vo.id}</td>
								<td><img class="main-img" src="{:getImgUrl($vo['package_img'])}&size=400"></td>
								<td>{$vo.package_name}</td>
								<td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
								<td>{$vo.end_time|date="Y-m-d H:i:s",###}</td>
								<td>{$vo.package_price|default=0}</td>
								<td>{$vo.package_desc|default="无"}</td>
								<td>
									<switch name="vo.dt_type">
										<case value="0">默认套餐</case>
										<case value="1">搭配购套餐</case>
										<default />
									</switch>
								</td>
								<td>
									<a class="btn btn-primary btn-sm" href="{:url('ProductPackage/detail',array('id'=>$vo['id']))}">详情</a>
									<div class="btn-group">
										<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
											更多 <span class="caret"></span>
										</button>
										<ul class="dropdown-menu">
											<li><a href="{:url('ProductPackage/edit',array('id'=>$vo['id']))}" class="btn btn-sm"><i class="fa fa-edit"></i>{:L('BTN_EDIT')}</a>
											</li>
											<li><a href="{:url('ProductPackage/delete',array('id'=>$vo['id']))}" class="btn btn-sm ajax-get confirm"><i class="fa fa-trash-o"></i>{:L('BTN_DELETE')}</a>
											</li>
										</ul>
									</div>
								</td>
							</tr>

						{/volist}
					{/empty}
				</tbody>
			</table>
			<div>{$show}</div>

		</div>
		<!-- END admin-main-content -->
	</div>
	<!-- END admin-main-->
{/block}

{block name="area_footer"}
	<script type="text/javascript">
		$('#type_selector').change(function(){
			var type = $(this).children('option:selected').val();
			if(type==-1){
				window.location.href = "{:url('productPackage/index')}";
			}else{
				window.location.href = "{:config('SITE_URL')}/index.php/admin/productPackage/index/type/" + type;
			}
		});
	</script>
{/block}